home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / Source / Chapter 10 / Engine / ViewFrustum.h < prev   
Encoding:
C/C++ Source or Header  |  2004-10-01  |  1.0 KB  |  29 lines

  1. //-----------------------------------------------------------------------------
  2. // Used to maintain a view frustum from the supplied view matrix.
  3. //
  4. // Programming a Multiplayer First Person Shooter in DirectX
  5. // Copyright (c) 2004 Vaughan Young
  6. //-----------------------------------------------------------------------------
  7. #ifndef VIEW_FRUSTUM_H
  8. #define VIEW_FRUSTUM_H
  9.  
  10. //-----------------------------------------------------------------------------
  11. // View Frustum Class
  12. //-----------------------------------------------------------------------------
  13. class ViewFrustum
  14. {
  15. public:
  16.     void Update( D3DXMATRIX *view );
  17.  
  18.     void SetProjectionMatrix( D3DXMATRIX projection );
  19.  
  20.     bool IsBoxInside( D3DXVECTOR3 min, D3DXVECTOR3 max );
  21.     bool IsBoxInside( D3DXVECTOR3 translation, D3DXVECTOR3 min, D3DXVECTOR3 max );
  22.     bool IsSphereInside( D3DXVECTOR3 translation, float radius );
  23.  
  24. private:
  25.     D3DXMATRIX m_projection; // Pointer to a projection matrix.
  26.     D3DXPLANE m_planes[5]; // Five planes of the view frustum (near plane is ignored).
  27. };
  28.  
  29. #endif